home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / DuchessLuynes.dxr / playing cards_61_foundation cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  4.0 KB  |  124 lines

  1. property spriteNum, motion, undercard, row, location
  2. global getlist, stock, equal, currentsel, godlist, foundation, points, tableau, basecard, mysuitb, mysuitt
  3.  
  4. on beginSprite me
  5.   mysuitb = []
  6.   mysuitt = []
  7.   row = determinerow()
  8.   undercard = sprite(spriteNum - 4)
  9.   location = sprite(spriteNum).loc
  10.   foundation.addProp(row, new(script("card pile")))
  11. end
  12.  
  13. on mouseDown me
  14.   if foundation[row].getcardcount() > 0 then
  15.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  16.     sprite(spriteNum).locZ = spriteNum + 1000
  17.     getlist = foundation[row]
  18.     if foundation[row].getcardcount() > 1 then
  19.       undercard.member = member(foundation[row].cards[foundation[row].getcardcount() - 1].membername, "playing cards")
  20.     else
  21.       if foundation[row].getcardcount() = 1 then
  22.         undercard.member = member("empty", "playing cards")
  23.       end if
  24.     end if
  25.     motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  26.   end if
  27. end
  28.  
  29. on moving me
  30.   if the mouseDown then
  31.     sprite(spriteNum).loc = the mouseLoc
  32.   else
  33.     if the mouseUp then
  34.       sprite(spriteNum).locZ = spriteNum
  35.       motion.forget()
  36.       abort()
  37.     end if
  38.   end if
  39. end
  40.  
  41. on mouseUp me
  42.   if equal then
  43.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  44.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  45.     godlist.addCard(currentsel)
  46.     sprite(spriteNum).loc = location
  47.     if foundation[row].cards.count = 1 then
  48.       if (sprite(currentsel).row = #fone) or (sprite(currentsel).row = #ftwo) or (sprite(currentsel).row = #fthree) or (sprite(currentsel).row = #ffour) then
  49.         mysuitb.deleteOne(foundation[row].cards[1].suit)
  50.       end if
  51.       if (sprite(currentsel).row = #ffive) or (sprite(currentsel).row = #fsix) or (sprite(currentsel).row = #fseven) or (sprite(currentsel).row = #feight) then
  52.         mysuitt.deleteOne(foundation[row].cards[1].suit)
  53.       end if
  54.     end if
  55.     foundation[row].cards.deleteOne(foundation[row].getlastcard())
  56.     if foundation[row].getcardcount() > 0 then
  57.       sprite(spriteNum).member = member(foundation[row].getlastcard().membername, "playing cards")
  58.     else
  59.       if foundation[row].getcardcount() = 0 then
  60.         sprite(spriteNum).member = member("empty", "playing cards")
  61.         undercard.member = member("empty", "playing cards")
  62.       end if
  63.     end if
  64.     equal = 0
  65.     if foundation[sprite(currentsel).row].cards.count = 1 then
  66.       if (sprite(currentsel).row = #fone) or (sprite(currentsel).row = #ftwo) or (sprite(currentsel).row = #fthree) or (sprite(currentsel).row = #ffour) then
  67.         if not mysuitb.findPos(foundation[sprite(currentsel).row].cards[1].suit) then
  68.           mysuitb.add(foundation[sprite(currentsel).row].cards[1].suit)
  69.         end if
  70.       end if
  71.       if (sprite(currentsel).row = #ffive) or (sprite(currentsel).row = #fsix) or (sprite(currentsel).row = #fseven) or (sprite(currentsel).row = #feight) then
  72.         if not mysuitt.findPos(foundation[sprite(currentsel).row].cards[1].suit) then
  73.           mysuitt.add(foundation[sprite(currentsel).row].cards[1].suit)
  74.         end if
  75.       end if
  76.     end if
  77.     currentsel = 0
  78.     godlist = VOID
  79.     getlist = VOID
  80.     checkwin()
  81.   else
  82.     if not equal then
  83.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  84.       getlist = VOID
  85.       sprite(spriteNum).loc = location
  86.     end if
  87.   end if
  88.   checkwin()
  89. end
  90.  
  91. on determinerow me
  92.   if spriteNum = 25 then
  93.     return #fone
  94.   else
  95.     if spriteNum = 26 then
  96.       return #ftwo
  97.     else
  98.       if spriteNum = 27 then
  99.         return #fthree
  100.       else
  101.         if spriteNum = 28 then
  102.           return #ffour
  103.         else
  104.           if spriteNum = 37 then
  105.             return #ffive
  106.           else
  107.             if spriteNum = 38 then
  108.               return #fsix
  109.             else
  110.               if spriteNum = 39 then
  111.                 return #fseven
  112.               else
  113.                 if spriteNum = 40 then
  114.                   return #feight
  115.                 end if
  116.               end if
  117.             end if
  118.           end if
  119.         end if
  120.       end if
  121.     end if
  122.   end if
  123. end
  124.